package com.liu.service.impl;

import com.alibaba.csp.sentinel.SphO;
import com.liu.service.StockService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class StockServiceImpl implements StockService {

    @Override
    public Map queryStock() {
        Map map = new HashMap<>();
        if(SphO.entry("查询库存")){
            System.out.println("查询库存");
            map.put("code",200);
            map.put("msg",10);
            SphO.exit();

        }else{
            map.put("code",0);
            map.put("msg","限流了");
        }

        return map;
    }
}
